import { Entity, Column, PrimaryGeneratedColumn } from 'typeorm';

@Entity()
export class Task {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  robotId: number;

  @Column({ nullable: true })
  userId: number;

  @Column({ default: 'text' })
  msgType: string;

  @Column('text')
  msgContent: string;

  @Column({ nullable: true })
  cron: string;

  @Column({ nullable: true })
  cronText: string;

  @Column({ default: '1' })
  status: string;

  @Column({ nullable: true })
  suite: string;

  @Column({ default: false })
  isWorkday: boolean;

  @Column({ nullable: true })
  remark: string;

  @Column({ default: false })
  isOneTime: boolean;

  @Column({ nullable: true, type: 'datetime' })
  executeTime: Date;

  @Column({
    type: 'timestamp',
    default: () => 'CURRENT_TIMESTAMP'
  })
  createDate: Date;

  @Column({
    type: 'timestamp',
    default: () => 'CURRENT_TIMESTAMP',
    onUpdate: 'CURRENT_TIMESTAMP'
  })
  updateDate: Date;
}